home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16690 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  33 lines

  1. Newsgroups: comp.lang.c++
  2. Path: presby.edu!jtbell
  3. From: jtbell@presby.edu (Jon Bell)
  4. Subject: Re: C++ beginner quesion on data member access.
  5. Message-ID: <DpppH8.Muw@presby.edu>
  6. Date: Thu, 11 Apr 1996 19:15:07 GMT
  7. References: <4kgb76$r3s@HOPPER.ACM.ORG> <Dpnpqz.2Io@presby.edu> <4kjhu2$338@HOPPER.ACM.ORG>
  8. Organization: Presbyterian College, Clinton, South Carolina USA
  9.  
  10.  Ken Varn <varnk@e62.diebold.com> wrote:
  11. >I am not questioning the validity of performing calculations using get or set 
  12. >member functions, I am mainly interested in if you should or should not 
  13. >always use get and set member functions when accessing data members if no 
  14. >calculations are needed.
  15.  
  16. If you are *absolutely*positively*certain* that you will *never*ever* 
  17. want to reorganize the member data of a certain class, after you have 
  18. already written code that uses that class; or if you are sure that you 
  19. (or anybody else who uses that class) will not mind re-writing any code 
  20. that uses the member data of that class, if you *do* reorganize the 
  21. member data... then I see no harm in making the member data public and 
  22. accessing it directly without get/set member functions.
  23.  
  24. If you think there is any possiblilty that you might want to reorganize 
  25. the member data later, then it is up to you to evaluate the tradeoff 
  26. between the time you save now by not writing get/set member functions, 
  27. and the time you (or somebody else) *might* save later by not having to 
  28. rewrite code that uses the member data directly.  It's your choice!  :-)
  29.  
  30. -- 
  31. Jon Bell <jtbell@presby.edu>                        Presbyterian College
  32. Dept. of Physics and Computer Science        Clinton, South Carolina USA
  33.